let oText=document.querySelector("textarea");
let oBtn=document.querySelector("button");
let Oul=document.querySelector("ul");

function talk(){
	let oLi=document.createElement("li");
	oLi.innerHTML=`
			<div class="ouser">
				<h6 class="USname">飞翔の企鹅</h6>
					<div class="user">
						${oText.value}
					</div>
			</div>
				`;
			Oul.appendChild(oLi);
			oLi.scrollIntoView();
			ajax("get", "js/brain.php", true, "infor=" + oText.value, fun);
			oText.value="";
}
function fun(str){
	// console.log(str)
	let obj=JSON.parse(str);

	let oLi=document.createElement("li");
	oLi.innerHTML=`
	
		<h6 class="UDname">Udesk智能客服机器人</h6>
			<div class="information">
					${obj.content}
			</div>
	
			`;
			Oul.appendChild(oLi);
			oLi.scrollIntoView();
}



document.onkeypress=function(evt){
	let e=evt||event;
	if(e.keyCode==13){
		talk();
	}
}
oBtn.onclick=function(){
	talk();
}
